import 'package:flutter/material.dart';

import 'Colorgamedata.dart';

class ColorGameItem extends StatelessWidget {
  const ColorGameItem({
    super.key,
    required this.size,
    required this.data,
  });
  final ColorGameData data;
  final Size size;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: size.width * 0.03),
      child: Column(
        children: [
          SizedBox(
            height: size.height * 0.05,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              Expanded(
                child: Image.asset(
                  data.img,
                ),
              ),
              Expanded(
                child: Image.asset(
                  data.img,
                ),
              ),
            ],
          ),
          SizedBox(
            height: size.height * 0.05,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                width: size.width * 0.55,
                height: size.width * 0.55,
                decoration: BoxDecoration(
                    color: data.color,
                    borderRadius: BorderRadius.circular(300),
                    boxShadow: [
                      BoxShadow(
                          color: Color(0xffA0A0A0).withOpacity(0.16),
                          blurRadius: 24,
                          offset: Offset(0, 24)),
                    ]),
              ),
              Expanded(
                child: RichText(
                    textAlign: TextAlign.center,
                    text: TextSpan(
                        text: '${data.text}\n',
                        style: TextStyle(
                            color: data.color,
                            fontSize: size.width * 0.1,
                            fontWeight: FontWeight.w900,
                            shadows: [
                              Shadow(
                                  color: Colors.black.withOpacity(0.16),
                                  blurRadius: 6,
                                  offset: Offset(0, 3))
                            ]),
                        children: [
                          TextSpan(
                            text: '${data.tip}',
                          ),
                        ])),
              )
            ],
          ),
        ],
      ),
    );
  }
}
//浮在上面点击左右切换???麻烦吗但是好像只能这样做哈哈
